//
//  UserConfig.m
//  KaKaWallet
//
//  Created by admin on 16/5/5.
//  Copyright © 2016年 ibendi. All rights reserved.
//
#import "NSUserDefaults+RMSaveCustomObject.h"

#import "UserConfig.h"

@implementation UserConfig

@synthesize userName;
@synthesize token;

+(UserConfig *)SharedUser
{
    NSUserDefaults* defaults2 = [NSUserDefaults standardUserDefaults];
    UserConfig *user = [defaults2 rm_customObjectForKey:@"USERDATA_DEFAULTS_KEY"];
    return user;
}

//判断是否登录
+(BOOL)isLogin
{
    UserConfig *user = [UserConfig SharedUser];
    if(user && user.userName != nil){
        return YES;
    }
    return NO;
}

+(void)saveUser:(id)object
{
    NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
    [defaults rm_setCustomObject:object forKey:@"USERDATA_DEFAULTS_KEY"];
    
}

+(void)logoutUser
{
    NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
    [defaults removeObjectForKey:@"USERDATA_DEFAULTS_KEY"];
}


@end
